"""
加速selenium：Plantomjs：弃用，无界面浏览器即不进行css渲染，运行效率高
             Chrome handless 在不打开浏览器下执行
"""
# 固定格式
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')

path = r'C:\Users\lenovo\AppData\Local\Google\Chrome\Application\chrome.exe'
chrome_options.binary_location = path

browser = webdriver.Chrome(chrome_options=chrome_options)

url = "https://www.baidu.com"
browser.get(url)
browser.save_screenshot("baidu.png")
